package cn.wolfcode.car.service.impl;

import cn.wolfcode.car.domain.Employee;
import cn.wolfcode.car.mapper.EmployeeMapper;
import cn.wolfcode.car.service.IEmployeeService;
import cn.wolfcode.car.query.EmployeeQueryObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
@Slf4j
public class EmployeeServiceImpl implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;
    @Override
    public List selectAll() {
        return employeeMapper.selectAll();
    }

    @Override
    public PageInfo<Employee> query(EmployeeQueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        return new PageInfo<>(employeeMapper.selectForList(qo));
    }
}
